#ifndef _JSONUSR_H_
#define _JSONUSR_H_

#include "common/common.h"

namespace iecas_ns
{
    #define PARAMS_JSON_FILE_NAME "json/params.json"
    #define ROUTES_JSON_FILE_NAME "json/routes.json"
    #define DEVICES_JSON_FILE_NAME "json/devices.json"
    #define IPNAME_JSON_FILE_NAME "json/ipname.json"
    #define TRANS_MESG_JSON_FILE_NAME "json/trans_mesg.json"
    #define TRANS_ORDER_CHG_JSON_FILE_NAME "json/trans_order_chg.json"
    #define TRANS_ORDER_OUT_JSON_FILE_NAME "json/trans_order_out.json"

    #define TCP_SERVER_PORT "tcp_server_port"
    #define HUAWEI_AOS_IP "huawei_aos_ip"
    #define HTTP_CAMERA_PORT_BASE "http_camera_port_base"

    class CJsonUsr
    {
		public:
			static shared_ptr<CJsonUsr> getInstance();
            CJsonUsr();
			bool init(void);
            void start(void);
            void getAllParams(Value &params);
            void getTcpServerPort(int &port);
            void getHuaweiAosIp(string &ip);
            void getHttpCameraPort(int &port);
            bool readFromJsonFile(string fileName, Value &fileContent);
            bool writeToJsonFile(string fileName, Value fileContent);
		private:
			static shared_ptr<CJsonUsr> sm_intancePtr;
            shared_ptr<CCommon> m_commonPtr;
            Value allParams;
            int tcp_server_port;
            string huawei_aos_ip;
            mutex m_http_camera_port_lock;
            int http_camera_port;
    };
}

#endif